<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>FFing</title><meta name="author" content="FFing"><meta name="copyright" content="FFing"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Windows、linux、mac技术分享">
<meta property="og:type" content="website">
<meta property="og:title" content="FFing">
<meta property="og:url" content="https://blog.ffing.fun/index.html">
<meta property="og:site_name" content="FFing">
<meta property="og:description" content="Windows、linux、mac技术分享">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png">
<meta property="article:author" content="FFing">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png"><link rel="shortcut icon" href="https://src.ffing.cn/hexo/img/fn_logo_32x32.png"><link rel="canonical" href="https://blog.ffing.fun/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/6.0.0/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdnjs.cloudflare.com/ajax/libs/flickr-justified-gallery/2.1.2/fjGallery.min.js',
      css: 'https://cdnjs.cloudflare.com/ajax/libs/flickr-justified-gallery/2.1.2/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'FFing',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2023-01-30 22:41:49'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/gundongtiao.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/custom.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/auth_icon.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/home_file_list.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/full_page.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/universe.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/nav_menu.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/txmap.css"><link rel="stylesheet" href="//at.alicdn.com/t/c/font_3830672_5bphzb91mjp.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/foot.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/aside.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/other_page.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/loading_bar.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/loading_gif.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/copyright.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/right_down_button.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/mouse.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/page_bg.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/lightlight.css"><link rel="stylesheet" href="https://src.ffing.cn/hexo/css/51la.css"><script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script><script src="https://sdk.51.la/perf/js-sdk-perf.min.js" crossorigin="anonymous"></script><script> LA.init({id:"JwsAbeTPm16yxMNJ",ck:"JwsAbeTPm16yxMNJ"})</script><script>new LingQue.Monitor().init({id:"JwsAbeTPm16yxMNJ",sendSuspicious:true});</script><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-double-row-display@1.00/cardlistpost.min.css"/>
<style>#recent-posts > .recent-post-item >.recent-post-info > .article-meta-wrap > .tags:before {content:"\A";
  white-space: pre;}#recent-posts > .recent-post-item >.recent-post-info > .article-meta-wrap > .tags > .article-meta__separator{display:none}</style>
<!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box" onclick="document.getElementById(&quot;loading-box&quot;).classList.add(&quot;loaded&quot;)"><div class="loading-bg"><div class="loading-img"></div><div class="loading-image-dot"></div></div></div><script>const preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',()=> { preloader.endLoading() })

if (false) {
  document.addEventListener('pjax:send', () => { preloader.initLoading() })
  document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}</script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/blue/pace-theme-minimal.min.css"/><script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js"></script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">10</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">23</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/archives/"><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/timeline/"><span> 更新</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog_name"><div class="back-home-button" tabindex="-1"><i class="back-home-button-icon fas fa-grip-vertical"></i><div class="back-menu-list-groups"><div class="back-menu-list-group"><div class="back-menu-list-title">网页</div><div class="back-menu-list"><a class="back-menu-item" href="https://www.ffing.cn" title="前往首页" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://src.ffing.cn/hexo/img/fn_white_logo.png"/><span class="back-menu-item-text">首页</span></a><a class="back-menu-item" href="http://pan.ffing.cn/" rel="external nofollow" title="前往alist网盘" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://src.ffing.cn/hexo/img/alist_logo.png"/><span class="back-menu-item-text">alist网盘</span></a><a class="back-menu-item" href="https://kms.ffing.cn/" rel="external nofollow" title="前往kms服务" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://src.ffing.cn/hexo/img/kms_logo.png"/><span class="back-menu-item-text">kms服务</span></a></div></div><div class="back-menu-list-group"><div class="back-menu-list-title">在线工具</div><div class="back-menu-list"><a class="back-menu-item" href="https://www.iconfont.cn" rel="noopener nofollow" title="前往阿里icon" target="_blank" one-link-mark="yes"><img class="back-menu-item-icon" src="https://src.ffing.cn/hexo/img/ali-icon_logo.png"/><span class="back-menu-item-text">阿里icon</span></a></div></div></div></div><a id="site-name" href="/"><div class="title">FFing</div><i class="fa-solid fa-house"></i></a></span><div class="mask-name-container"><center id="name-container"><a id="page-name" href="javascript:btf.scrollToDest(0, 500)">PAGE_NAME</a></center></div><div id="weather"></div><div id="tp-weather-widget"></div> <div id="menus"><div class="nav-button" id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="nav-button" id="darkmode_navswitch"><a class="darkmode_switchbutton" type="button" title="浅色和深色模式转换" onclick="switchDarkMode()"><i class="fas fa-adjust"></i></a></div><div class="nav-button" id="nav-totop"><a class="totopbtn"><i class="fas fa-arrow-up"></i><span id="percent" onclick="btf.scrollToDest(0,500)">0</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/archives/"><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/timeline/"><span> 更新</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/posts/20211221153232-4c7d71f9.html" title="centos 搭建本地yum源、网络yum源"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos 搭建本地yum源、网络yum源"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20211221153232-4c7d71f9.html" title="centos 搭建本地yum源、网络yum源">centos 搭建本地yum源、网络yum源</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-12-21T07:32:32.000Z" title="发表于 2021-12-21 15:32:32">2021-12-21</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/yum%E4%BC%98%E5%85%88%E7%BA%A7/">yum优先级</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/yum%E6%BA%90/">yum源</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/%E6%9C%AC%E5%9C%B0yum/">本地yum</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/%E7%BD%91%E7%BB%9Cyum/">网络yum</a></span></div><div class="content">频繁访问外网源占用带宽，且速度有限，所以搭建局域网源是必须的。
yum源下载rpm，是由本地repo文件配置控制的，所有核心就是我们的repo文件。
repo文件格式：
12345678#中括号内为yum源标签[ffing]#yum源描述name=ffing-centos7#yum源地址（baseurl支持四种协议：ftp、http、file、rsync）baseurl=http://ffing.cn/yum#秘钥检测：gpgcheck=0

环境：

系统版本：centos7.6
ISO镜像：centos7.6（yum源文件）
nginx1.16（web服务器）

流程

搭建本地yum源
发布yum目录
网络yum源配置
yum源优先级

一，搭建本地yum源简单讲：创建yum仓库目录–&gt;配置repo文件–&gt;测试OK
1.准备本地yum仓库将iso文件复制到本地目录，作为仓库源
1.1提前创建需要目录
12#创建本地yum仓库目录mkdir -p /yum/centos7-iso

1.2挂载iso镜像到&#x2F;mnt
12#挂载光盘到mnt下mount /dev/ ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/20211118115517-65c613e1.html" title="centos 部署多个tomcat并systemd控制"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos 部署多个tomcat并systemd控制"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20211118115517-65c613e1.html" title="centos 部署多个tomcat并systemd控制">centos 部署多个tomcat并systemd控制</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-11-18T03:55:17.000Z" title="发表于 2021-11-18 11:55:17">2021-11-18</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E6%95%99%E7%A8%8B/">教程</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/centos/">centos</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/tomcat/">tomcat</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/linux/">linux</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/systemd/">systemd</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/tomcat%E9%9B%86%E7%BE%A4/">tomcat集群</a></span></div><div class="content">tomcat包是绿色文件，所以以包的方式部署win和linux集群的方式是一样的，唯一需要更改的就是server.xml端口（保障端口不冲突），就实现了集群。
我的脚本：
bash &lt;(curl https://gitee.com/ffing/onekey/raw/master/onekey.sh)

第一种方法：快捷方式win集群：复制N个包，修改N个server.xml端口，创建N对快捷方式到桌面（start.bat、shutodwn.bat）
linux集群：复制N个包，修改N个server.xml端口，创建N对软链接到&#x2F;usr&#x2F;bin下(start.sh、shutdown.sh)
这种快捷方式部署的方式，效率很高，什么也不用配置，创建快捷方式就OK，但后期管理就很不方便了（譬如上个zabbix，脚本就需要再根据情况编写）
第二种方法：配置环境变量配置环境变量，就可以实现systemd进行控制。
流程：
下载安装tomcat
配置环境变量
更新tomcat变量
修改tomcat访问端口
防火墙放行端口
创建systemd服务文件
测试

本次集群以3个t ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/posts/20211117165540-93d10bf1.html" title="centos 安装tomcat并systemctl控制"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos 安装tomcat并systemctl控制"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20211117165540-93d10bf1.html" title="centos 安装tomcat并systemctl控制">centos 安装tomcat并systemctl控制</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-11-17T08:55:40.000Z" title="发表于 2021-11-17 16:55:40">2021-11-17</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/centos/">centos</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/java/">java</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/tomcat/">tomcat</a></span></div><div class="content">tomcat依赖java环境，所以需要先安装java。
因为这几天需要tomcat集群环境，这里使用tomcat8包进行安装。
安装很简单，就是个绿色包，直接运行就可以，但为了后期管理方便要配置环境变量。
我的脚本：
bash &lt;(curl https://gitee.com/ffing/onekey/raw/master/onekey.sh)

流程
安装配置java
安装配置tomcat
配置system服务
测试

一，安装配置JAVA请看我前面文章：centos 安装JAVA
二，安装配置tomcattomcat官网：https://tomcat.apache.org/

下载,并解压tomcat包到&#x2F;usr&#x2F;local&#x2F;
（解压的路径需要记住，后面要配置环境）
12345678#安装wget（如已安装可以忽略）yum -y insatll wget#下载tomcat（路径可能失效，请官网更新）wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.72/bin/apache-tomcat-8.5 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/20211115220453-26cdf4b7.html" title="centos 搭建ftp(匿名+本地用户)"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos 搭建ftp(匿名+本地用户)"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20211115220453-26cdf4b7.html" title="centos 搭建ftp(匿名+本地用户)">centos 搭建ftp(匿名+本地用户)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-11-15T14:04:53.000Z" title="发表于 2021-11-15 22:04:53">2021-11-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/%E6%95%99%E7%A8%8B/">教程</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/centos/">centos</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/ftp/">ftp</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/vsftpd/">vsftpd</a></span></div><div class="content">今天临时需要用下ftp，发现我云服务器的ftp被我改完配置后没有恢复，导致无法使用，这里记录一下，顺便存个脚本。
bash &lt;(curl https://gitee.com/ffing/onekey/raw/master/onekey.sh)
本脚本vsftp实现：匿名+本地用户访问FTP！

流程：

创建ftp账号&#x2F;组
安装vsftpd
创建目录及文件
配置vsftpd
测试ftp

第一步，创建用户&#x2F;组创建FTP组：
12#以&quot;ftpgroup&quot;为ftp组groupadd ftpgroup

创建FTP目录：
123#以&quot;/ftp&quot;为根目录，并更改属组mkdir /ftpchown :ftpgroup /ftp

创建FTP用户：
12#创建用户&quot;ffing&quot;（配置bash、家目录、组、备注）useradd -s /sbin/nologin -d /ftp/ffing -g ftpgroup -c &quot;FTP用户&quot; ffing

第二步，安装vsftpd123456789101 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/posts/20211102152601-2853445c.html" title="centos 7 重置root密码"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos 7 重置root密码"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20211102152601-2853445c.html" title="centos 7 重置root密码">centos 7 重置root密码</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-11-02T07:26:01.000Z" title="发表于 2021-11-02 15:26:01">2021-11-02</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/centos/">centos</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/root%E5%AF%86%E7%A0%81/">root密码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/%E5%BF%98%E8%AE%B0%E5%AF%86%E7%A0%81/">忘记密码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/%E9%87%8D%E7%BD%AE%E5%AF%86%E7%A0%81/">重置密码</a></span></div><div class="content">服务器时间久了没人管，忘记密码情况还是有的。
第一步，重启，进入系统选择，按键盘“e”，编辑引导

第二步，在liunx16行，追加enforcing&#x3D;0 init&#x3D;&#x2F;bin&#x2F;bash，后ctrl +x
(此配置解释：关闭selinux，默认启动&#x2F;bin&#x2F;bash)

第三步，重新挂载根目录并rw权限，修改root密码，重启

</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/20211027112216-a548af97.html" title="centos 查看修改时间、时区"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos 查看修改时间、时区"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20211027112216-a548af97.html" title="centos 查看修改时间、时区">centos 查看修改时间、时区</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-27T03:22:16.000Z" title="发表于 2021-10-27 11:22:16">2021-10-27</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/centos%E6%97%B6%E5%8C%BA/">centos时区</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/centos%E6%97%B6%E9%97%B4/">centos时间</a></span></div><div class="content">查看时间、时区（CST:China Standard Time UT+8:00）
1date

手动修改时间
12#将系统时间改为2020年1月1日0点date -s &quot;2020-01-01 00:00:00&quot;

同步时间（需安装ntpdate）
12#同步阿里云时间ntpdate ntp.aliyun.com

修改时区
12345#第一种通过timedatectl命令timedatectl set-timezone Asia/Shanghai#第二种更新/etc/localtime文件rm -rf /etc/localtimeln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

查看硬件（bios）时间
1hwclock

系统时间和硬件时间进行同步
12345#可通过hwclock --help自行查看#用系统时间同步硬件时间hwclock -w 或者 hwclock --systohc      #用硬件时间同步系统时间hwclock -s 或者 hwclock --hctosys     </div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/posts/20211018200601-e63938c.html" title="centos-查看命令属于哪个包"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos-查看命令属于哪个包"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20211018200601-e63938c.html" title="centos-查看命令属于哪个包">centos-查看命令属于哪个包</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-10-18T12:06:01.000Z" title="发表于 2021-10-18 20:06:01">2021-10-18</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/liunx/">liunx</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/%E5%91%BD%E4%BB%A4%E5%B1%9E%E4%BA%8E%E5%93%AA%E4%B8%AA%E5%8C%85/">命令属于哪个包</a></span></div><div class="content">偶尔遇到使用某个命令提示命令不存在，但又不知道这个命令具体属于哪个包，这里提供两种方法解决。
第一种：通过yum provides
1yum provides */《命令》


第二种：通过已安装命令的机器，来反向排查
1234#先查询已安装命令的真实路径which 《命令》#再通过rpm来查看是哪个安装包rpm -qf 命令真实路径


第三种：使用yum search（有的命令出不来，推荐第一、二种）
1yum search 《命令》


</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/20210602103808-3f501af3.html" title="Centos -安装Memcached服务端和php扩展（memcache | memcached)"><img class="post_bg" src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Centos -安装Memcached服务端和php扩展（memcache | memcached)"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/20210602103808-3f501af3.html" title="Centos -安装Memcached服务端和php扩展（memcache | memcached)">Centos -安装Memcached服务端和php扩展（memcache | memcached)</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-06-02T02:38:08.000Z" title="发表于 2021-06-02 10:38:08">2021-06-02</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Memcache/">Memcache</a></span></div><div class="content">Memcache是一个高性能的分布式的内存对象缓存系统，通过在内存里维护一个统一的巨大的hash表，它能够用来存储各种格式的数据，包括图像、视频、文件以及数据库检索的结果等。简单的说就是将数据调用到内存中，然后从内存中读取，从而大大提高读取速度。
我的环境centos7，nginx+mysql+php

编译安装

一，安装服务端：Memcached
二，启动服务端：Memcached
三，安装客户端：php扩展（memcache memcached)
四，配置客户端：php扩展（memcache memcached)
五，查看php扩展（memcache memcached)


yum安装Memcached


————编译安装————一，安装服务端：Memcached1234#查看yum可安装的Memcachedyum list memcached*#通过yum安装memcached、memcached-develyum -y install memcached memcached-devel

二，启动服务端：Memcached1234567891011#memcached参数 ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/#content-inner">2</a><a class="extend next" rel="next" href="/page/2/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="author-info__description"><img style="float:left;width:100px;height:100px " src="https://src.ffing.cn/hexo/img/fn_logo.png"><p style="font-size:13px">兴趣是最好的老师<br>时间是最贵的学费</p></div></div><div class="card-info-social-icons is-center"><a class="social-icon faa-parent animated-hover" href="mailto:79131627@qq.com" target="_blank" title="Email"><svg class="social_icon iconfont" aria-hidden="true"><use xlink:href="#icon-youxiang"></use></svg></a><a class="social-icon faa-parent animated-hover" href="https://gitee.com/ffing" target="_blank" title="Gitee"><svg class="social_icon iconfont" aria-hidden="true"><use xlink:href="#icon-gitee"></use></svg></a><a class="social-icon faa-parent animated-hover" href="https://space.bilibili.com/376172153" target="_blank" title="BiliBili"><svg class="social_icon iconfont" aria-hidden="true"><use xlink:href="#icon-bilibili-line1"></use></svg></a></div></div><div class="card-widget card-ip"><div class="item-headline"><div id="welcome-info"></div></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">wordpress迁移Hexo完成</div></div><div class="sticky_layout"><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Linux/"><span class="card-category-list-name">Linux</span><span class="card-category-list-count">10</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E6%95%99%E7%A8%8B/"><span class="card-category-list-name">教程</span><span class="card-category-list-count">3</span></a></li>
            </ul></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/12/"><span class="card-archive-list-date">十二月 2021</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/11/"><span class="card-archive-list-date">十一月 2021</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">4</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/10/"><span class="card-archive-list-date">十月 2021</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">2</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/06/"><span class="card-archive-list-date">六月 2021</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/05/"><span class="card-archive-list-date">五月 2021</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/03/"><span class="card-archive-list-date">三月 2021</span><div class="card-archive-list-count-group"><span class="card-archive-list-count">1</span><span>篇</span></div></a></li></ul></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By FFing</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div><div id="footer-banner"><div class="footer-banner-links"><div class="footer-banner-left"><div class="footer-banner-left"><div id="footer-banner-tips"></div><script src="https://src.ffing.cn/hexo/js/typed.min.foot_daziji.js"></script><script>var typed = new Typed("#footer-banner-tips", {
  strings: ["你不在正经事上忧虑,就会在乱七八糟事上忧虑,能力守恒!", "折腾硬件、软件;折腾系统、平台;折腾开发、环境;折腾window、linux;折腾,折腾,瞎J8折腾."],
  startDelay: 200,
  backDelay: 2000,
  typeSpeed: 100,
  loop: true,
  backSpeed: 20
})
</script></div></div><div class="footer-banner-right"><p><a target="_blank" href="https://hexo.io/"><img src="http://src.ffing.cn/hexo/img/Frame-Hexo-blue.svg" title="框架"></a>&nbsp;<a target="_blank" href="https://butterfly.js.org/"><img src="http://src.ffing.cn/hexo/img/Theme-Butterfly.svg" title="主题"></a>&nbsp;<a target="_blank" href="https://www.upyun.com/"><img src="http://src.ffing.cn/hexo/img/CDN又拍云.svg" title="CDN加速"></a>&nbsp;<a target="_blank" href="https://www.51.la/"><img src="http://src.ffing.cn/hexo/img/Analytics-51la.svg" title="51la统计"></a>&nbsp;<a target="_blank" href="https://www.upyun.com/"><img src="http://src.ffing.cn/hexo/img/豫ICP备2021016009.svg" title="ICP备案"></a></p></div></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.umd.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"></div><script src="https://src.ffing.cn/hexo/js/jquery.min.3.6.3.js"></script><canvas id="universe"></canvas><script defer src="https://src.ffing.cn/hexo/js/universe.js"></script><script defer src="https://src.ffing.cn/hexo/js/switchDarkMode.js"></script><script defer src="https://src.ffing.cn/hexo/js/nav_menu.js"></script><script async data-pjax src="https://src.ffing.cn/hexo/js/txmap.js"></script><script async src="//at.alicdn.com/t/c/font_3830672_5bphzb91mjp.js"></script><script src="https://src.ffing.cn/hexo/js/jquery.min.js"></script><script src="https://src.ffing.cn/hexo/js/weather.js"></script><script src="https://src.ffing.cn/hexo/js/foot_runtime.js"></script></div></body></html>